import { createRouter, createWebHistory } from 'vue-router'
import UserLoginPage from '@/pages/user/UserLoginPage.vue'
import UserManagePage from '@/pages/system/UserManagePage.vue'
import HomePage from '@/pages/HomePage.vue'
import TeacherInfoPage from '@/pages/teacher/TeacherInfoPage.vue'
import CourseSchedulePage from '@/pages/teacher/TeachingSchedulePage.vue'
import UserInfoPage from '@/pages/user/UserInfoPage.vue'
import StudentInfoPage from '@/pages/student/StudentInfoPage.vue'
import StudentGroupPage from '@/pages/student/StudentGroupPage.vue'
import CourseManagePage from '@/pages/academic/CourseManagePage.vue'
import ExamManagePage from '@/pages/academic/ExamManagePage.vue'
import StudentScorePage from '@/pages/student/StudentScorePage.vue'
import NoticeManagePage from '@/pages/system/NoticeManagePage.vue'
import NoticeAddPage from '@/pages/system/NoticeAddPage.vue'
import NoticeUpdatePage from '@/pages/system/NoticeUpdatePage.vue'
import ResourceManagePage from '@/pages/system/ResourceManagePage.vue'
import NotFoundPage from '@/pages/NotFoundPage.vue'
import ACCESS_ENUM from '@/common/accessEnum.ts'
import NoAccessPage from '@/pages/NoAccessPage.vue'
import MyScorePage from '@/pages/student_user/MyScoreProfilePage.vue'
import MyStudentProfilePage from '@/pages/teacher_user/MyStudentProfilePage.vue'
import TeachingGroupPage from '@/pages/teacher_user/TeachingGroupPage.vue'
import TeacherNumByGenderPage from '@/pages/visualization/TeacherNumByGenderPage.vue'
import StudentScoreNumByLevel from '@/pages/visualization/StudentScoreNumByLevel.vue'
import TeacherNumByAgePage from '@/pages/visualization/TeacherNumByAgePage.vue'
import NoticeListPage from '@/pages/teacher_user/NoticeListPage.vue'
import NoticeProfilePage from '@/pages/teacher_user/NoticeProfilePage.vue'
import StudentNoticeListPage from '@/pages/student_user/StudentNoticeListPage.vue'
import StudentNoticeProfilePage from '@/pages/student_user/StudentNoticeProfilePage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/user/login',
      name: '用户登录',
      component: UserLoginPage,
      meta: {
        access: ACCESS_ENUM.NOT_LOGIN,
      },
    },
    {
      path: '/',
      name: '首页',
      component: HomePage,
      meta: {
        access: ACCESS_ENUM.LOGIN,
      },
    },
    {
      path: '/user/info',
      name: '个人信息',
      component: UserInfoPage,
      meta: {
        access: ACCESS_ENUM.LOGIN,
      },
    },
    {
      path: '/teacher/info',
      name: '教师信息',
      component: TeacherInfoPage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/teacher/courseSchedule',
      name: '授课安排',
      component: CourseSchedulePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/student/info',
      name: '学生信息',
      component: StudentInfoPage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/student/group',
      name: '班级管理',
      component: StudentGroupPage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/student/score',
      name: '成绩管理',
      component: StudentScorePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/academic/course',
      name: '课程管理',
      component: CourseManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/academic/exam',
      name: '考试管理',
      component: ExamManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/visualization/teacher/numByGender',
      name: '教师性别分布',
      component: TeacherNumByGenderPage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      }
    },
    {
      path: '/visualization/teacher/numByAge',
      name: '教师年龄分布',
      component: TeacherNumByAgePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      }
    },
    {
      path: '/visualization/studentScore/numByLevel',
      name: '学生成绩分布',
      component: StudentScoreNumByLevel,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      }
    },
    {
      path: '/system/notice',
      name: '通知公告',
      component: NoticeManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/notice/add',
      name: '新增通知',
      component: NoticeAddPage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/notice/update/:id',
      name: '更新通知',
      component: NoticeUpdatePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/system/userManage',
      name: '用户管理',
      component: UserManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/system/resource',
      name: '资源管理',
      component: ResourceManagePage,
      meta: {
        access: ACCESS_ENUM.ADMIN,
      },
    },
    {
      path: '/stuUser/myScore/profile',
      name: '分数详情',
      component: MyScorePage,
      meta: {
        access: ACCESS_ENUM.STUDENT,
      },
    },
    {
      path: '/stuUser/notice/list',
      name: '系统通知列表',
      component: StudentNoticeListPage,
      meta: {
        access: ACCESS_ENUM.STUDENT,
      },
    },
    {
      path: '/stuUser/notice/:id',
      name: '系统通知详情',
      component: StudentNoticeProfilePage,
      meta: {
        access: ACCESS_ENUM.STUDENT,
      },
    },
    {
      path: '/teaUser/myStudent/profile',
      name: '学生详情',
      component: MyStudentProfilePage,
      meta: {
        access: ACCESS_ENUM.TEACHER,
      },
    },
    {
      path: '/teaUser/myGroup/teaching',
      name: '任教班级',
      component: TeachingGroupPage,
      meta: {
        access: ACCESS_ENUM.TEACHER,
      },
    },
    {
      path: '/teaUser/notice/list',
      name: '通知列表',
      component: NoticeListPage,
      meta: {
        access: ACCESS_ENUM.TEACHER,
      },
    },
    {
      path: '/teaUser/notice/:id',
      name: '通知详情',
      component: NoticeProfilePage,
      meta: {
        access: ACCESS_ENUM.TEACHER,
      },
    },
    {
      path: '/access/NoAccess',
      name: '403',
      component: NoAccessPage,
      meta: {
        access: ACCESS_ENUM.LOGIN,
      },
    },
    {
      path: '/:pathMatch(.*)*',
      name: '404',
      component: NotFoundPage,
      meta: {
        access: ACCESS_ENUM.NOT_LOGIN,
      },
    },
  ],
})

export default router
